<template>
	<view>
		<view class="flex_start item" v-for="(item,i) in list" :key="i">
			<image :src="item.interviewAvatar || '../../static/img/default.png'" class="photo" mode=""></image>
			<view class="flex_start info_box">
				<view class="info">
					<view class="item_name">{{item.interviewNickname || '游客'}}</view>
					<image src="../../static/img/man.png" v-if="item.interviewSex == 1" class="sex_icon" mode=""></image>
					<image src="../../static/img/woman.png" v-if="item.interviewSex == 2" class="sex_icon" mode=""></image>
				</view>
				<view class="">2019-08-25 13:31</view>
			</view>
		</view>
		<view class="no_data" v-if="total < 1">暂无记录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				info: {
					page:1,
					pageSize: 20
				},
				total: 0
			};
		},
		onShow() {
			this.getList()
		},
		onPullDownRefresh(){ //下拉刷新
			this.info.page = 1
			this.getList()
			uni.stopPullDownRefresh()
		},
		onReachBottom(){ //上垃加载
			if(this.info.page < this.total) {
				this.info.page++
				this.getList()
			}
		},
		methods:{
			getList(){
				this.$utils.requert({ url: 'myInterview', data: this.info, type: 'post' }).then(res => {
					if (res.code === 1) {
						let data = res.data.list;
						this.total = Math.ceil(res.data.total / this.info.pageSize)
						if (this.info.page == 1) {
							this.list = this.list.concat(data)
						} else {
							this.list = data
						}
					} else {
						this.$utils.showLayer(res.message);
					}
				});
			},
		}
	}
</script>

<style lang="scss">
.no_data{
	font-size: 28rpx;
	color: #999999;
	text-align: center;
	padding-top: 100rpx;
}
.item{
	margin: 0 30rpx;
	.info_box{
		justify-content: space-between;
		font-size: 26rpx;
		flex: 1;
		color: #9A9898;
		padding: 30rpx 0;
		border-bottom: 2rpx solid #DADADA;
	}
	.sex_icon{
		width: 21rpx;
		height: 21rpx;
	}
	.photo{
		flex-shrink: 0;
		width: 84rpx;
		height: 84rpx;
		border-radius: 50%;
		margin-right: 20rpx;
	}
}
</style>
